const install = (Vue, vm) => {
    let check = () => {
        // 获取本地存储的信息
        let LoginAdmin = uni.getStorageSync('LoginAdmin') ? uni.getStorageSync('LoginAdmin') : {}

        // 登录信息等于false 或者 转成字符串时 等于 '{}'
        if (!LoginAdmin || JSON.stringify(LoginAdmin) === '{}') {
            uni.showToast({
                title: '请先登录',
                icon: 'error',
                duration: 1500,
                success: () => {
                    setTimeout(() => {
                        uni.switchTab({
                            url: '/pages/admin/index/index'
                        })
                    }, 1500)
                }
            })

            return false
        }

        return true
    }

    vm.$u.auth = {
        check
    }
}

export default {
    install
}